home *** CD-ROM | disk | FTP | other *** search
- /*
- File: BigEasyControls.h
-
- Written by: dvb
-
- Copyright: © 1990-1991 by Apple Computer, Inc., all rights reserved.
-
- This file is used in these builds: Warhol
-
- Change History (most recent first):
-
- <6> 4/13/92 dvb #ifdef for multiple inclusions.
- <5> 4/3/92 dvb Oh, structure names should start with upper case. What was I
- thinking of, anyway?
- <4> 1/20/92 dvb Latest BigEasy revs.
- <3> 12/19/91 JB removing think 4.0 code
- <2> 5/28/91 JB Added prototypes for BigEasy Proc Ptrs
- <3> 8/3/90 dvb Smarter rectangle changes
- <2> 7/31/90 dvb Update for control-list-handles
-
- To Do:
- */
-
- /*
- * file: BigEasyControls.h
- *
- * started 25 May 1990 12:07:24 Friday at 310 Nobel
- *
- * david van brink
- *
- */
-
- #ifndef _BigEasyControls_
- #define _BigEasyControls_
-
- /************************************
- * types
- ************************************/
-
- /*
- * void NewProc(easyControlPtr ec);
- * void DisposeProc(easyControlPtr ec);
- * void TrackProc(easyControlPtr ec,Point p);
- */
-
- typedef void (*becNewProcPtr)(struct easyControlRecord *ec);
- typedef void (*becDisposeProcPtr)(struct easyControlRecord *ec);
- typedef void (*becDrawProcPtr)(struct easyControlRecord *ec);
- typedef void (*becHitTestProcPtr)(struct easyControlRecord *ec,Point p);
- typedef void (*becTrackProcPtr)(struct easyControlRecord *ec,Point p,short *result,short mods);
- typedef void (*becKeyProcPtr)(struct easyControlRecord *ec,short key,short mods,Boolean *tookKey);
- typedef void (*becSetValueProcPtr)(struct easyControlRecord *ec,long value);
- typedef void (*becIdleProcPtr)(struct easyControlRecord *ec,long *ref);
- typedef void (*becDrawValueProcPtr)(struct easyControlRecord *ec); /* Function Pointer */
-
- typedef void (*becActionProcPtr)(long value,long refcon);
- typedef void (*becInitActionProcPtr)(long value,long refcon);
- typedef void (*becDoneActionProcPtr)(long value,long refcon);
- typedef void (*becValueProcPtr)(struct easyControlRecord **ec);
-
- typedef struct
- {
- becNewProcPtr newProc;
- becDisposeProcPtr disposeProc;
- becDrawProcPtr drawProc;
- becHitTestProcPtr hitTestProc;
- becTrackProcPtr trackProc;
- becKeyProcPtr keyProc;
- becSetValueProcPtr setValueProc;
- becIdleProcPtr idleProc;
- becDrawValueProcPtr drawValueProc;
- } easyControlType;
-
- #ifdef privateEasyControls
- /*
- * This should only be included by control manager and controls
- */
-
- typedef struct easyControlRecord
- {
- easyControlType *type;
- Rect rect;
- long refcon;
- long id; /* Sort of another refcon, used to uniquely identify each control */
- long variation;
- long flags; /* Common states, like "active/inactive" */
- long value; /* Could be a pointer or handle to complex value */
- void *state; /* For internal use of the type */
- void *style; /* Shared style information, depending on type */
- short color[6]; /* Defines the color appearance of the control, in 555 colors */
- becActionProcPtr actionProc; /* while dragging */
- becInitActionProcPtr initActionProc; /* called once before dragging */
- becDoneActionProcPtr doneActionProc; /* called once after dragging */
- becValueProcPtr valueProc; /* called when value changes */
- /* CFP keyProc; /* to process key presses */
- long low,high; /* range of control */
- struct easyControlRecord **prev;
- struct easyControlRecord **next;
- struct easyControlListRecord **list;
- } easyControlRecord,*easyControlPtr,**easyControl;
- /* #define easyControlPtr easyControlRecord * */
-
- enum /* flags field of easyControl */
- {
- easyControlActive = 1,
- easyControlBack = 2, /* set when the owner window is background */
- easyControlTracking = 4, /* set while the control is tracking */
- easyControlSetValue = 8, /* set if redraw is for "setvalue" */
- easyControlMoved = 16 /* set when the control has moved, cleared by cdef */
- };
-
- typedef struct easyControlListRecord
- {
- easyControl firstControl;
- easyControl selectedControl;
- easyControl nextSelectedControl; /* if nothing selected, this may specify what "tab" gets to */
- short textFont;
- short textFace;
- short textSize;
- WindowPtr ownerWindow; /* the window these controls are attached to */
- long refcon; /* for the application */
- long idleRef;
- long nextIdle;
- long ticksPerIdle;
- long controlCount;
- } easyControlListRecord, *easyControlListPtr, **easyControlList;
-
- #else
-
- typedef struct {
- long dummy;
- } **easyControl;
-
- typedef struct {
- long dummy;
- } **easyControlList;
-
- #endif
-
-
- typedef struct
- {
- easyControl whichControl;
- Boolean tracked;
- long value;
- long refcon;
- long id;
- } controlClickResult;
-
- enum /* colors in a control */
- {
- controlFrame = 0,
- controlBackground,
- controlPart1,
- controlPart2
- };
-
-
- /************************************
- * Macros
- ************************************/
- #define AsFloat(x) ( *((float *)(& x))) /* interpret a var's bits as if they was floatin' pt */
- #define PackColor555(r,g,b) (( (r)>>11<<10) | ( (g)>>11<<5) | ( (b)>>11))
-
- #define EasyControl easyControl
- #define EasyControlList easyControlList
- #define ControlClickResult controlClickResult
-
- /************************************
- * prototypes
- ************************************/
-
- easyControlList NewEasyControlList(WindowPtr w, long refcon);
- void DisposeEasyControlList(easyControlList list);
-
- easyControl NewEasyControl(easyControlType *,Rect *,long variation,
- void *style,long refcon,long id, long value,easyControlList list);
- void DisposeEasyControl(easyControl, easyControlList list);
-
- void SetEasyControlRange(easyControl ech,long low,long high);
- void SetEasyControlValueProc(easyControl ech, becValueProcPtr valueProc);
- void SetEasyControlActionProc(easyControl ech, becActionProcPtr actionProc);
- void SetEasyControlInitActionProc(easyControl ech, becInitActionProcPtr initActionProc);
- void SetEasyControlDoneActionProc(easyControl ech, becDoneActionProcPtr doneActionProc);
-
- void SetEasyControlValue(easyControl ech,long value);
- long GetEasyControlValue(easyControl);
- long GetEasyControlRefcon(easyControl);
- long GetEasyControlID(easyControl);
- void GetEasyControlRect(easyControl,Rect *);
- void SetEasyControlRect(easyControl,Rect *);
-
- void DrawEasyControlList(easyControlList list);
- easyControl ClickEasyControlList(easyControlList list,Point p,
- controlClickResult *,short mods);
- void KeyEasyControlList(easyControlList list,short key,short mods,controlClickResult *ccr);
- void ActivateEasyControlList(easyControlList list);
- void DeactivateEasyControlList(easyControlList list);
-
- void GetEasyControlColors(easyControl,short *colors);
- void SetEasyControlColors(easyControl,short *colors);
- void IdleEasyControlList(easyControlList list);
-
- void Fore555(short);
- void Fore555Light(short);
- void Fore555Dark(short);
- void Fore555Contrast(short);
- unsigned short Replicate555(unsigned short);
- void Color555(short,RGBColor *c);
-
- void RaisedRect(Rect *r,short x);
- void LoweredRect(Rect *r,short x);
-
-
- #endif _BigEasyControls_
-